package za.org.jcicada.comms.impl.katcp;

/**
 * KatcpConnection.java
 *
 * @author Simon Cross
 *
 * Created on 20 February 2009, 10:25
 */

import java.nio.channels.SocketChannel;

import za.org.jcicada.comms.IKatcpSerializerStrategy;
import za.org.jcicada.comms.impl.tcp.TcpConnection;

/**
 * A KATCP implementation of a katcomms IConnection.
 *
 * Provides the necessary functionality for setting up, using and managing
 * two-way network communication using katcp on a tcp socket. 
 */
public class KatcpConnection extends TcpConnection {

    /**
     * Create a KatcpConnection.
     *
     * Implements the katcomms connection on top of a KATCP/TCP socket.
     *
     * @param socket  The TCP socket connection.
     */
    public KatcpConnection(SocketChannel channel, IKatcpSerializerStrategy katcpSerializer) {
        super(channel);
        // FIXME: Parent constructor pointlessly creates a TcpCommsBuffer -- maybe sort that out somehow.
        commsBuffer = new KatcpCommsBuffer(katcpSerializer);
    }

}
